import random
import time
import uuid

from httprunner import __version__


def get_httprunner_version():
	return __version__


def sum_two(m, n):
	return m + n


def sleep(n_secs):
	time.sleep(n_secs)


def sleep_random_seconds() -> int:
	secs = random.randint(1, 5)
	print(f'sleep_random_seconds: {secs}')
	time.sleep(secs)
	return secs


def random_int() -> int:
	return random.randint(1, 5)


def check_sleep_seconds(secs: int):
	if secs < 3:
		print("sleep < 3s, sleep 2 more seconds...")
		time.sleep(2)
	else:
		print(f"sleep {secs}s, no need to sleep seconds...")


def get_unique_request_id():
	"""获取唯一的request id"""
	request_id = str(uuid.uuid4())
	# print(f'request_id: {request_id}')
	return request_id


def get_unique_id():
	"""获取唯一的request id"""
	unique_id = str(uuid.uuid4())
	return unique_id


def get_random_folder_name(prefix: str) -> str:
	"""
	返回随机的文件名
	:param prefix: 文件名前缀
	:return:
	"""
	timestamp = round(time.time() * 1000)
	folder_name = f'{prefix}-{timestamp}'
	return folder_name
